/**
 * @User: vitobo
 * @Date: 2024-06-17
 * @Description: 链表学习
 *
 *  链表: 物理上不一定是连续的,逻辑上是连续的
 *
 *
 */



public class Test {
    public static void main(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        myLinkedList.addLast(1);
        myLinkedList.addLast(2);
        myLinkedList.addLast(3);
        myLinkedList.addLast(4);
        myLinkedList.addLast(5);
        myLinkedList.display();
        System.out.println("====================");

        myLinkedList.remove(3);
        myLinkedList.display();



    }

    public static void main1(String[] args) {
        MySingleList mySingleList = new MySingleList();
        //mySingleList.createList();
//        mySingleList.addFirst(1);
//        mySingleList.addFirst(2);
//        mySingleList.addFirst(3);

        mySingleList.addLast(1);
        mySingleList.addLast(2);
        mySingleList.addLast(2);
        mySingleList.addLast(3);
        mySingleList.addLast(4);
        mySingleList.addLast(2);
        mySingleList.addLast(5);

        mySingleList.display();
        mySingleList.addIndex(3,80);
        mySingleList.display();
        mySingleList.remove(80);
        mySingleList.display();

        mySingleList.removeAllKey(2);
        mySingleList.display();

        mySingleList.clear();
        mySingleList.display();

        System.out.println("单链表长度:" + mySingleList.size());
        //System.out.println("是否包含34: " + mySingleList.contains(34));


    }
}
